package mvndemo.learn;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class ThreadDemo {
	private static int i=1;
	private static  String az="abcdefghijklmnopqrstuvwxyz";
	private static boolean flag=true;
	public static void main(String[] args) {
		final Lock l = new ReentrantLock();
			Thread a=new Thread(new Runnable() {
				public void run() {
					while(i<=52){
						System.out.print(i);
						if(i%2==0){
							flag=false;
							try {
								this.wait();
							} catch (InterruptedException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							}
						}
						i++;
					}
				}
			});
			Thread b=new Thread(new Runnable() {
				public void run() {
					char[] str=az.toCharArray();
					for(int v=0;v<str.length;v++){
						System.out.print(str[v]);
						flag=true;
					}
				}
			});
			a.start();
			b.start();
	}
}
